from django import forms
from .models import Topic, Entry


# 为模型Topic创建表单
class TopicForm(forms.ModelForm):
    class Meta:
        model = Topic
        fields = ['text']
        labels = {'text': ''}


# 为模型Entry创建表单
class EntryForm(forms.ModelForm):
    class Meta:
        model = Entry
        fields = ['text']
        labels = {'text': ' '}
        widgets = {'text': forms.Textarea(attrs={'cols': 80})}
        # 该widgets属性（小部件）是一个表单元素 如单行文本框，多行文本区域或下拉列表 区域宽度设置为80列